package com.ruoyi.framework.flex;

import com.mybatisflex.annotation.UpdateListener;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.common.utils.SecurityUtils;

public class UpdateByListener implements UpdateListener {
    @Override
    public void onUpdate(Object entity) {
        BaseEntity baseEntity = (BaseEntity) entity;
        try {
            baseEntity.setUpdateBy(SecurityUtils.getUsername());
        } catch (Exception e) {
            baseEntity.setUpdateBy("系统管理员");
        }
    }
}
